<%
    var isAdd = false;
    if(isEmpty(brand)){
        isAdd = true;
}%>
  <% 
    var headContent = {
  %>
  <style type="text/css">
 /*验证：提示信息样式 begin*/
   .am-alert-danger {
      background-color: transparent;
      border-color: transparent;
      color: red;
    }
    .am-alert {
      margin-bottom: 1em;
      padding: .625em;
      background: transparent;
      border: none;
      border-radius: 0;
    }
    /*验证：提示信息样式 end*/
}
 </style>
 <script type="text/javascript">
$(function(){
	$("#isEnabledSwitch").on('switchChange.bootstrapSwitch',function(event, state) {
      if (state.toString() == "true") {
        $("#isEnabled").val("1");
      } else {
        $("#isEnabled").val("0");
      }
    });


  $("#submit").on("click",function(){
      $("#form").submit();
  });
});
</script>
 <%
};
%>
<%layout("/common/_layout.html",{head:headContent}){%>
<form id="form"  method="POST" class="am-form" action="${base}/brand/save" data-am-validator>
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">品牌管理</strong> / <small><%if(isAdd){%>添加品牌<%}else{%>编辑品牌<%}%></small></div>
  </div>
<input type="hidden" id="id" name="brand.id" value="${brand.id!}" />
<input type="hidden" id="isAdd" name="isAdd" value="${isAdd!}" />
  <!--选项卡（tabs）begin-->
  <div class="am-tabs am-margin" data-am-tabs>
    <ul class="am-tabs-nav am-nav am-nav-tabs">
      <li class="am-active"><a href="#tab1"><%if(isAdd){%>添加品牌<%}else{%>编辑品牌<%}%></a></li>
    </ul>
    <div class="am-tabs-bd">
      <div class="am-tab-panel am-active" id="tab1">
          <!--验证表单元素（validate) begin-->
          <!--input begin-->
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">
              <span  style="color: red;">*</span>名称：
            </div>
            <div class="am-u-sm-6 am-u-md-6">
              <input type="text" id="name" name="brand.name" value="${brand.name!}" minlength="1" maxlength="32" placeholder="品牌的名称为1-32个字母、汉字、数字、下划线的组合" required/><!-- <%if(isAdd){%><%}else{%>readonly="readonly"<%}%> -->
            </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg">
              <div class="am-alert am-alert-danger">${brandNameMessages!}</div>
            </div>
          </div>

          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span  style="color: red;">*</span>创建时间：</div>
            <div class="am-u-sm-6 am-u-md-6">
	            <div class="am-form-group am-form-icon">
			    	<i class="am-icon-calendar"></i>
			    	<input id="datePicker" type="text" name="brand.create_time" class="am-form-field" id="create_time" value="${brand.create_time!}" placeholder="创建日期" readonly data-am-datepicker={format:'yyyy-mm-dd hh:ii:ss'} required>
			    </div>
		    </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg">
                <div class="am-alert am-alert-danger">${brandCreateTimeMessages!}</div>
            </div>
          </div>
         <!-- 
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">是否启动：</div>
            <div class="am-u-sm-6 am-u-md-6">
	            <div class="switch-button"> 
	                 	<input id="isEnabledSwitch" type="checkbox" data-size='xs' data-am-switch  data-off-text="已停用" data-on-text="已启用"  
	                  	<%if(isAdd || brand.enabled){%>
	                            checked="checked"
	                  	<%}else{%><%}%>
	                  	/>
	                  	<input type="hidden" class="am-input-sm" name="brand.enabled" id="isEnabled"
              				value="${(isAdd || brand.enabled)?1:0}" />
                </div>
		    </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
          </div>
          -->
          <input type="hidden" class="am-input-sm" name="brand.enabled" id="isEnabled"
                            value="1" />
                            
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">描述：</div>
            <div class="am-u-sm-6 am-u-md-6">
              <textarea id="cmt" rows="5" name="brand.description" minlength="0" maxlength="256" placeholder="请输入描述信息，最多256个字符">${brand.description!}</textarea>
            </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
          </div>
          
          <!--验证表单元素（validate end-->
      </div>
      </div>
  </div>
  </form>
  <!--选项卡（tabs）end-->
  <div class="am-margin">
    <button type="button" id="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
    <button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="window.history.back(); return false;">返回上一级</button>
  </div>

<%}%>